﻿Public Class ImageTab
    Inherits TabPage

    Public Property Image() As Image

    Protected Friend m_pictureBox As PictureBox
    Private m_ScrollView As ScrollableControl

    Public Sub New(ByVal path As String)
        MyBase.New()

        Me.Name = path
        Me.Text = IO.Path.GetFileName(path)
        Me.Image = Image.FromFile(path)

        Me.m_ScrollView = New ScrollableControl()
        Me.m_ScrollView.Width = Me.Width
        Me.m_ScrollView.Height = Me.Height
        Me.m_ScrollView.Location = New Point(0, 0)

        Me.m_pictureBox = New PictureBox()
        Me.m_pictureBox.Anchor = _
            CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
            Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.m_pictureBox.Image = Me.Image
        Me.m_pictureBox.Width = Me.Width
        Me.m_pictureBox.Height = Me.Height
        Me.m_pictureBox.SizeMode = PictureBoxSizeMode.StretchImage
        Me.m_pictureBox.Location = New Point(0, 0)

        Me.m_ScrollView.Controls.Add(Me.m_pictureBox)
        Me.Controls.Add(Me.m_pictureBox)
    End Sub

End Class